/*
* ---------------------------------------------------------------------
* Copyright (c) 2014, 2015 All Right Reserved
* This software is developed for study and improve coding skill ...
*
* Project:  Excellent Coding < EC >
*
* ecNode.h
* This file for basic struct Node type define.
* Eamil:  epengao@126.com
* Author: Peter Gao
* Version: First initinal version.
* --------------------------------------------------------------------
*/

#ifndef ecNode_H
#define ecNode_H

#include "ecBaseType.h"

namespace ec {

template<typename T>
class ecNode
{
public:
    ecNode(const T *pData)
           :m_sData(*pData)
           ,m_pNext(EC_NULL) {}

public:
    T          m_sData;
    ecNode<T>* m_pNext;
};

template<typename T>
class ecOVONode
{
public:
    ecOVONode(T *pData)
             :m_sData(*pData)
             ,m_pPrev(EC_NULL)
             ,m_pNext(EC_NULL) {}

public:
    T  m_sData;
    T* m_pPrev;
    T* m_pNext;
};

template<typename KeyT, typename ValT>
class ecPairNode
{
public:
    ecPairNode(KeyT* pKey = EC_NULL,
               ValT* pVal = EC_NULL)
    {
        if(pKey) m_sKey = *pKey;
        if(pVal) m_sVal = *pVal;
    }

public:
    KeyT    m_sKey;
    ValT    m_sVal;
};
} /* namespace ec */
#endif /* ecNode_H */